{extend name="common/base" /}
{block name="main"}
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body ">
            <div class="layui-row">
                <form class="layui-form">
                    <input type="hidden" value="{$order['id']}" name="id">
                    <div class="layui-form-item">
                        <label  class="layui-form-label">
                            订单号
                        </label>
                        <div class="layui-input-inline" style="font-weight: 400;line-height: 37px;">{$order['vip_order_sn']}</div>
                    </div>
                    <div class="layui-form-item">
                        <label  class="layui-form-label">
                            用户手机号
                        </label>
                        <div class="layui-input-inline" style="font-weight: 400;line-height: 37px;">{$order['mobile']}</div>
                    </div>
                    <div class="layui-form-item">
                        <label  class="layui-form-label">
                            用户昵称
                        </label>
                        <div class="layui-input-inline" style="font-weight: 400;line-height: 37px;">{$order['nickname']}</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">绑定销售</label>
                        <div class="layui-input-block">
                            <select name="pid" lay-verify="required" >
                                <option value=""></option>
                                {foreach $spreads as $id=>$name}
                                <option value="{$id}">{$name}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label  class="layui-form-label">
                        </label>
                        <button  class="layui-btn layui-btn-normal" lay-filter="toBindUsser" lay-submit="">
                            确定
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


{/block}
{block name="footer"}
<script>
    layui.use(['form', 'layer','upload'],
        function() {
            let form = layui.form,
                upload = layui.upload,
                $ = layui.jquery,
                layer = layui.layer;
            //监听提交
            form.on('submit(toBindUsser)',function(data) {
                //发异步，把数据提交给php
                $.ajax({
                    url:"/backmanage/vip_renew/toBindUser",
                    data:data.field,
                    type:"Post",
                    traditional: true,
                    dataType:"json",
                    success:function(data){
                        if(!data.code){
                            layer.alert("操作成功", {icon: 6},function () {
                                // 可以对父窗口进行刷新
                                window.parent.location.reload();
                                // 获得frame索引
                                var index = parent.layer.getFrameIndex(window.name);
                                //关闭当前frame
                                parent.layer.close(index);
                            });
                        }else{
                            layer.msg(data.msg);
                        }
                    },
                    error:function(data){
                        layer.msg('操作失败');
                    }
                });
                return false;
            });
        });
</script>
{/block}
